class Person {
  String? name;
  int? age;
  String? _nickName;
  String? email;

  Person(this.name, this.age, this._nickName, this.email) {
    print('我是构造方法');
  }

  //可以定义多个命名构造函数
  Person.now() {
    print('我是命名构造函数');
  }

  setNickName(String nickname) {
    this._nickName = nickname;
  }

  void printInfo() {
    print('用户信息:$name, $age, $_nickName,$email');
  }
}

main() {
  Person.now();
  Person p = new Person('和珅', 32, '大贪官', '11111@a.com');
  p.printInfo();
  p.setNickName('大学士');
  p.printInfo();

  p..name = '纪晓岚'
    ..age = 10
    ..email = '222@a.com'
    ..printInfo();
}
